home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 43.zip
/
Sources C - WorkDisk II.adf
/
hop1.c
next >
Wrap
C/C++ Source or Header
|
1987-01-02
|
3KB
|
172 lines
#include "exec/types.h"
#include "intuition/intuition.h"
#include "math.h"
struct IntuitionBase *IntuitionBase;
struct Window *NoBorder;
struct GfxBase *GfxBase;
struct RastPort *r;
struct Screen *Scrn;
#define INTUITION_REV 29
#define GRAPHICS_REV 29
main()
{
ULONG flags;
SHORT x,y,w,h,d,c0,c1;
USHORT mode;
VOID delayfunc(),OpenALL();
int i,num;
float aa,uu,vv,a,b,c;
register float u, v;
double sqrt(),fabs();
OpenALL();
/* ======Open een hires custom screen====== */
y=0;
w=640;
h=400;
d=4;
c0=0x07;
c1=0x09;
mode=HIRES;
Scrn=(struct Screen *)
make_screen(y,w,h,d,c0,c1,mode,NULL);
/* ======open een borderless window ====== */
x=y=0;
w=640;
h=200;
flags = ACTIVATE|SMART_REFRESH|BORDERLESS;
NoBorder=(struct Window *)
make_window(x,y,w,h,NULL,flags,Scrn,c0,c1);
/* ======teken muurpapier====== */
r=NoBorder->RPort;
num = 50000;
a =-3.141592;
b =0.4;
c =0.4;
u=v=uu=vv=0.0;
for(i=0;i <= num;i=num)
{
tekenpixel(3,r,((int)u*30)+320,((int)v*15)+120);
uu = v - (u<0?1:-1)*sqrt((double)(fabs((double)b*v-c)));
vv = a - v;
u = uu;
v = vv;
};
/* ======Tijds-pauze====== */
delayfunc(100);
/* ======Close de windows in volgorde====== */
CloseWindow(NoBorder);
delayfunc(10);
CloseScreen(Scrn);
}
VOID OpenALL()
{
/*==Intuition==*/
IntuitionBase=(struct IntuitionBase *)
OpenLibrary("intuition.library",INTUITION_REV);
if(IntuitionBase==NULL)
exit(FALSE);
/*==Graphics Library==*/
GfxBase=(struct GfxBase *)
OpenLibrary("graphics.library",GRAPHICS_REV);
if(GfxBase==NULL)
exit(FALSE);
}
make_window(x,y,w,h,name,flags,screen,color0,color1)
SHORT x,y,w,h;
UBYTE *name,color0,color1;
ULONG flags;
struct Screen *screen;
{
struct NewWindow NewWindow;
NewWindow.LeftEdge = x;
NewWindow.TopEdge = y;
NewWindow.Width = w;
NewWindow.Height = h;
NewWindow.DetailPen = color0;
NewWindow.BlockPen = color1;
NewWindow.Title = name;
NewWindow.Flags = flags;
NewWindow.IDCMPFlags = NULL;
NewWindow.Type = CUSTOMSCREEN;
NewWindow.FirstGadget = NULL;
NewWindow.CheckMark = NULL;
NewWindow.Screen = screen;
NewWindow.BitMap = NULL;
NewWindow.MinWidth = 0;
NewWindow.MinHeight = 0;
NewWindow.MaxWidth = 0;
NewWindow.MaxHeight = 0;
return(OpenWindow(&NewWindow));
}
VOID delayfunc(factor)
int factor;
{
int loop;
for(loop=0;loop < factor*1000;loop++)
;
return;
}
make_screen(y,w,h,d,color0,color1,mode,name)
SHORT y,w,h,d;
UBYTE color0,color1,*name;
USHORT mode;
{
struct NewScreen NewScreen;
NewScreen.LeftEdge = 0;
NewScreen.TopEdge = y;
NewScreen.Width = w;
NewScreen.Height = h;
NewScreen.Depth = d;
NewScreen.DetailPen = color0;
NewScreen.BlockPen = color1;
NewScreen.ViewModes = mode;
NewScreen.Type = CUSTOMSCREEN;
NewScreen.Font = NULL;
NewScreen.DefaultTitle = name;
NewScreen.Gadgets = NULL;
NewScreen.CustomBitMap = NULL;
return(OpenScreen(&NewScreen));
}
tekenpixel(col,rast,s,t)
int col,s,t;
struct RastPort *rast;
{
SetAPen(rast,col);
WritePixel(rast,s,t);
}